import static org.junit.Assert.*;
import models.Exercise;
import models.RegisteredUser;
import models.ReviewRequest;
import org.junit.*;
import java.util.*;

import javax.persistence.Entity;

import play.test.*;
import models.*;
import controllers.Application;

import play.test.UnitTest;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;


public class MyCreatedExercises extends UnitTest {
	/***@author dana
	 * This is the JUnit test for the user story my created exercises
	 */
	@Test
	public void testOfMyCreatedExercises() {
	
	RegisteredUser user = new RegisteredUser("dana", "dana@gmail.com",
			"123", false);
	RegisteredUser user2 = new RegisteredUser("hadeer", "donna@gmail.com",
			"123", false);
	Exercise x = new Exercise(user.id, 1, "My first Exercise");
	Exercise x1 = new Exercise(user.id, 1, "My first Exercise");
	Exercise x2 = new Exercise(user2.id, 1, "My first Exercise");
	user.save();
	x.save();
	x1.save();
	List<Exercise> q = new ArrayList<Exercise>();
	q.add(x);
	q.add(x1);
	List<Exercise> q2 = new ArrayList<Exercise>();
	q2.add(x2);
	assertNotNull(q);
	assertNotNull(q2);
	assertEquals(2,q.size());
	assertEquals(1,q2.size());
	List<Exercise> myExercises;
	List<Exercise> myExercises1;
	myExercises = Exercise.find("creatorId=?", user).fetch();
	myExercises1 = Exercise.find("creatorId=?", user2).fetch();
	assertEquals(q,myExercises);
	assertEquals(q2,myExercises1);
	
	
	
	
}

	
	}
